<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>addroles</title>
		<meta name="renderer" content="webkit|ie-comp|ie-stand">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<meta http-equiv="Cache-Control" content="no-siteapp" />
		<script src="/style/public/publicStyle.js"></script>
		<style type="text/css">
			.layui-table-tool-panel li .layui-form-checkbox[lay-skin=primary] {
				/* width: 100%; */
				padding-left: 28px;
			}
			.layui-table-tool-panel li {
				line-height: 30px;
				-webkit-transition: .5s all;
				transition: .5s all;
				padding-left: 10px;
				padding-right: 47px;
			}
		</style>
	</head>

	<body >
<div class="weadmin-body" id="vm">  
	
	<form class="layui-form">
  <div class="layui-form-item">
    <label class="layui-form-label">添加权限</label>
    <div class="layui-input-block">
     <div v-for="(value,index)  in info" >
     	<div v-if="value.star">
		   <input type="checkbox"  v-bind:name="value.id"  v-bind:title="value. name"checked />
		    </div>
		    <div v-else>
		  <input type="checkbox"  v-bind:name="value.id"  v-bind:title="value. name" />
		    </div>
     </div>
    </div>
  </div>

  <div class="layui-form-item">
    <div class="layui-input-block">
      <button class="layui-btn" lay-submit lay-filter="formDemo" type="button">立即提交</button>
      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
  </div>
</form>

</div>	
</body>
<script src="/style/lib/vue/jquery-3.0.0.js"></script>
 <script src="/style/lib/vue/vue.js"></script>
 <script>
 		var logintoken=  getSharreTieba_LoginToken();
 		   var  permissions_Id=getCookieVal('Addpermissions_roles_Id'); 	
 		   
   $(function(){  
 var vm= new Vue({
            el: "#vm",
            data: {
                info: "信息列表"
            }, methods: {

            }
        });
	    $.ajax({
	    	type:"get",
	    	url:"/permission/getPermissionsAll",
	    	data:{'LoginKey':logintoken,'id':permissions_Id},
	    	async:false,
	    	success:function(json){ 
	    	 vm.info=json.extend.info;
	    	 console.log(vm.info)
	    	}
	    });
	 });
</script>     
	<script>
layui.use(['util','laydate', 'laypage', 'layer', 'table', 'carousel', 'upload', 'element'], function(){
        var util = layui.util;
        var laydate = layui.laydate //日期
            ,laypage = layui.laypage //分页
            ,layer = layui.layer //弹层
            ,table = layui.table //表格
            ,carousel = layui.carousel //轮播
            ,upload = layui.upload //上传
            ,element = layui.element //元素操作
             ,form = layui.form
             　layui.form.render();    
     form.on('submit(formDemo)', function(data){
     	console.log(JSON.stringify(data));
     	 $.ajax({
     	 	type:"post",
     	 	url:"/permission/RolesSetPermissions",
	    	data:{'LoginKey':logintoken,'id':permissions_Id,'data':JSON.stringify(data.field)},
     	 	async:true,
     	 	success:function(json){
     	 		
     	 	}
     	 });
     	
    layer.msg('操作成功!');
    
    return false;
  });
   
});

  
</script>

</html>
